Repository navigation
monitoring: agent + tool-call OTel spans for Maple (tool_origin attribution) - #5
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instrument Hermes agent activity into Maple via OTel (Raisal, 2026-11-14): session/turn lifecycle spans plus every tool call — Executor tools included — with a strict content-free allowlist.
What exists vs what this adds
The fleet line already carries the agent-trace plane (
agent/monitoring/agent_traces.py+gateway/agent_trace_emit.py): session/turn/tool spans over the monitoring bus, pseudonymized correlation ids, per-kind attribute allowlists, GenAI semconv dual-emit, TTL sweep for abandoned spans, OFF by default behindmonitoring.agent_traces.enabled+monitoring.export.otlp.{enabled,endpoint,headers_env}. Producers bind at the two real seams: admitted turn execution (trace_executionat the turn facade) and the single tool dispatch point (trace_toolintool_executor) — so every tool call (native, MCP, Executor) already produces start/end spans with tool name, call id, duration, status/error and session/turn/model correlation.This PR adds the one missing attribute:
AgentToolExecEvent.tool_origin—"native"or"mcp:<server>"(Executor calls arrive asmcp:executor), derived from themcp__<server>__<tool>naming convention at dispatch, appended to the wire shape (never reordered), allowlisted into the span,redact_boundedapplies. No prompts, arguments, results or secrets enter the plane — the charter is untouched and tested.Export target
monitoring.export.otlpstays operator-configured by design; the Maple endpoint and the OpenBao-held ingest key are deployment config per fleet host (asked from the Maple cutover thread rather than invented here). Sender mechanics per the Maple deployment: OTLP HTTP to the LAN Caddy origin/v1/traces,headers_envmapping an env var to theauthorizationheader (env value carries the fullBearer <key>),service.name=hermes-gateway(or per-host),deployment.environment.name=prod. Talos first; fleet rollout only after Talos validation; no gateway restart without Raisal.Executor coverage note
The Executor itself is a distroless upstream container we can't instrument without forking it. Coverage at the Hermes MCP/tool-call layer gives complete executor-tool tracking: every executor call is a
mcp:executortool span with name, duration, ok/error and session/turn correlation, parented under the turn span. Per-executor-address attribution rides the MCP server name today; a registry lookup for instance addresses is a small follow-up if wanted.Lane
Branch carries the fleet live state on top of fork
main(same pattern as #2/#4 — the fleet serving trees run this line). Focused gate: branch-only workflowmonitoring-maple-traces.ymlrunning the monitoring + trace-producer regressions. Local verification: py_compile + plain-python smoke (wire order, allowlist entry, origin derivation).